/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package avl.sv.shared;

import avl.sv.shared.Annotations.AnnotationSet;
import java.awt.geom.Path2D;
import java.io.Serializable;
import java.util.ArrayList;
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;

/**
 *
 * @author benbryan
 */
public class ClassifierClass extends DefaultMutableTreeTableNode implements Serializable  {
    
    public String className;
    
    public ClassifierClass() {}   
    public ClassifierClass(String className) {
        super(className);
        this.className = className;
    }
    
    public String getClassName() {
        return className;
    }
    
    public void setClassName(String name) {
        this.className = name;
        super.setUserObject(name);
    }

    @Override
    public void setUserObject(Object userObject) {
        if (userObject instanceof String){
            super.setUserObject(userObject);
            className = (String) userObject;
        }
    }
    
    public ArrayList<AnnotationSet> getAnnotationSets() {       
        if (children == null){
            return new ArrayList<>();
        }
        ArrayList<AnnotationSet> annotSet = new ArrayList<>();
        for (Object o:children){
            if (o instanceof AnnotationSet){
                annotSet.add((AnnotationSet)o);
            }
        }
        return annotSet;
    }
}

